//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "ioc\count.sqf"
#include <core_macros.h>

TRACE_1("Start",_this);

private ["_namespace","_event","_idx","_evt_idx","_events","_count"];
DEFAULT_PARAM(_namespace,0,"");
DEFAULT_PARAM(_event,1,"");

_count = 0;
if (IS_STRING(_namespace) && IS_STRING(_event) && {_namespace != ""} && {_event != ""}) then {
	_idx = GVAR(NAMESPACES) find toLower(_namespace);
	if (_idx >= 0) then {
		_events = GVAR(EVENTS) select _idx;
		_evt_idx = _events find toLower(_event);
		if (_evt_idx >= 0) then {
			_count = count ((GVAR(HANDLERS) select _idx) select _evt_idx);
		} else {
			TRACE_1("Invalid Event",_this);
		};
	} else {
		TRACE_1("Invalid Namespace",_this);
	};
} else {
	TRACE_1("Invalid Event",_this);
};

TRACE_1("End",_count);
_count;